<?php
require_once('include.php');

$test = new TestEngine();

$db = new DB(null);

$db->startConnection();


/**
 * TEST SEARCH FUNCTION
 * 
 * @tester hungvinh
 */
echo "== SEARCH FUNCTION TEST(data_v0.5.1.sql) ==<br />";
// test 1
$a = $db->searchData('book', 'summary', 'is');
$test->checkValue(count($a), 3);
//$test->checkMessage("<pre>" . print_r($a , true). "</pre>", 'BOOK RESULTS');

// test 2

$a = $db->searchData('category', 'name', 'Food');
$test->checkValue(count($a), 1);
//$test->checkMessage("<pre>" . print_r($a , true). "</pre>", 'CATEGORY RESULTS');

// test 3

$a = $db->searchData('config', 'key', 'spec');
$test->checkValue(count($a), 1);
//$test->checkMessage("<pre>" . print_r($a , true). "</pre>", 'CONFIG RESULTS');

// test 4

$a = $db->searchData('static', 'detail', 'Ipsum');
$test->checkValue(count($a), 4);
//$test->checkMessage("<pre>" . print_r($a , true). "</pre>", 'STATIC RESULTS');

// test 4

$a = $db->searchData('user', 'username', 'user');
$test->checkValue(count($a), 2);
//$test->checkMessage("<pre>" . print_r($a , true). "</pre>", 'USERNAME RESULTS');

// test 5

$a = $db->searchData('book', 'detail', 'Potter');
$test->checkMessage("<pre>" . print_r($a , true). "</pre>", 'BOOK DETAIL RESULTS');


$test->total();

$db->closeConnection();

?>